﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Globalization;
using System.Data;
using Public;

namespace WebsiteAdmin.Salomon.ProInfo.Handler
{
    /// <summary>
    /// $codebehindclassname$ 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class SerList : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string rtn = "";
            if (Cookie.AdminLoginName != null || Cookie.AdminLoginName != "")
            {
                int pkid = Convert.ToInt32(context.Request["PKID"], CultureInfo.InvariantCulture);
                DataTable dt = Bll.Series.MULTIPLE(Global.ConSalomon, pkid);
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        rtn += "{\"PKID\":\"" + dt.Rows[i]["PKID"].ToString() + "\",\"SerName\":\"" + dt.Rows[i]["SeriesName"].ToString() + "\"},";
                    }
                    rtn = rtn.Substring(0, rtn.Length - 1);
                }
                dt.Dispose();
            }
            rtn = "[" + rtn + "]";
            context.Response.Write(rtn);
            HttpContext.Current.ApplicationInstance.CompleteRequest();

        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}

